package cn.alex.springaidemo.openAi.function;

import java.util.function.Function;

/**
 * 天气服务
 *
 * @author Alex
 * @date 2024/9/20 03:20
 */
public class WeatherFunctionService implements Function<WeatherFunctionService.Request, WeatherFunctionService.Response> {

    @Override
    public Response apply(Request request) {
        System.out.println("request:" + request);
        if (request == null || request.location == null) {
            return new Response("地址不能为空");
        }
        if (request.location.equals("北京")) {
            return new Response("太热了");
        }
        return new Response("其他城市不知道多少度，应该很凉快");
    }

    public record Request(String location) {
    }

    public record Response(String content) {
    }
}
